<?php

/**
 * Created by PhpStorm.
 * Author: cmq
 * Time: 2024/01/17 11:40
 * Desc:
 */
class Model_Api_V2_Product
{
    /**
     * 获取产品属性
     * @param $attr_id
     * @param $table
     * @return array
     */
    public static function get_product_attr($attr_id, $table)
    {
        $attr_list = array();
        // 如果产品有属性 传过去
        if ($attr_id) {
            $attr_table = $table . '_attr';
            $attr_list  = DB::select('attrname')
                ->from($attr_table)
                ->where(DB::expr("FIND_IN_SET(id,'" . $attr_id . "')"))
                ->execute()
                ->as_array();
        }
        return $attr_list;
    }
}